<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/commons/taglibs.jsp"%>
<!DOCTYPE html >
<html>
<head>
</head>
<body>

	<table width="100%" border="0" cellspacing="0" cellpadding="0"
		class="tab">
		<tr>
			<th>序号</th>
			<th>创建日期</th>
			<th>标题</th>
			<th>所属部门</th>
			<th>内容</th>
			<th>最后修改时间</th>
			<th>创建者</th>
			<th>操作</th>
		</tr>
		<c:if test="${empty resultDto.result  }">
			<tr>
				<td colspan="8">没有记录</td>
			</tr>
		</c:if>

		<c:forEach items="${resultDto.result}" var="result" varStatus="sn">
			<tr>
				<td>${sn.index+1 }</td>
				<td><fmt:formatDate value="${result.createDate}"
						pattern="yyyy年MM月dd日" /></td>
				<td title="${result.title}">${result.title}</td>
				<td title="${result.departName}">${result.departName}</td>
				<td title="${result.content}">
				<c:choose>
				<c:when test="${fn:length(result.content)>20}">${fn:substring(result.content, 0, 20)}</c:when>
				<c:otherwise>${result.content}</c:otherwise>
				</c:choose>
				</td>
				<td title="<fmt:formatDate
						value="${result.lastUpdateDate}" pattern="yyyy年MM月dd日" />"><fmt:formatDate
						value="${result.lastUpdateDate}" pattern="yyyy年MM月dd日" /></td>
				<td title="${result.creatorName}">${result.creatorName}</td>
				 
				<td title=""><c:choose>
					<c:when test="${actionType eq '6'}">
							<a href="#" onclick="processWorkSystem('${result.noticeId}')">处理
							</a> &nbsp;&nbsp;
					</c:when>
						<c:otherwise>
							<a
								href="${ctx }/workSystem/workSystemAction!updateInit.action?workSystem.id=${result.id}">编辑
							</a> &nbsp;&nbsp;
					<a href="#" onclick="removeWorkSystem('${result.id}')">删除 </a> &nbsp;&nbsp;
					</c:otherwise>
					</c:choose></td>
			</tr>
		</c:forEach>
	</table>
	<s:if test="resultDto.result!=null && resultDto.result.size()>0">
		<!--分页 begin-->
		<div class="pageleft">共有${resultDto.pagination.total}条数据，当前第${resultDto.pagination.index+1}页</div>
		<%-- 	<div class="pageleft">
		共有${resultDto.pagination.total }条数据，当前第<span id="pageCodeId"></span>页
	</div> --%>
		<c:choose>
			<c:when test="${actionType eq '6'}">
				<div class="pagenum">
					<a href="#" id="topPage"
						onclick="queryPageByCon('${ctx}/workSystem/workSystemAction!toCenterList.action',0,'noticeResult');">首页</a>
					<span id="Paginationa"></span> <a href="#" id="endPage"
						onclick="queryPageByCon('${ctx}/workSystem/workSystemAction!toCenterList.action','${totalPage-1 }','noticeResult');">尾页</a>
				</div>
			</c:when>
			<c:otherwise>
				<div class="pagenum">
					<a href="#" id="topPage"
						onclick="queryPage('${ctx}/workSystem/workSystemAction!listInit.action',0);">首页</a>
					<span id="Paginationa"></span> <a href="#" id="endPage"
						onclick="queryPage('${ctx}/workSystem/workSystemAction!listInit.action','${totalPage-1 }');">尾页</a>
				</div>
			</c:otherwise>
		</c:choose>

		<input type="hidden" id="totalRow"
			value="${resultDto.pagination.total }" />
		<input type="hidden" id="totalPage" value="${totalPage }" />
		<div class="clear"></div>
	</s:if>
</body>
<script type="text/javascript">
function removeWorkSystem(workSystemId){
	art.dialog.confirm('你确认删除操作 ', function(){
		$.post("${ctx}/workSystem/workSystemAction!delete.action", {
			random : Math.random(),
			"workSystem.id" : workSystemId
		}, function(data) {
			var jsonData = strToJson(data);
			if (jsonData.flag == "success") {
				art.dialog.tips('操作成功！', 1.5);
				window.location.href = "${ctx}/workSystem/workSystemAction!listInit.action";
			} else {
				art.dialog.tips('操作失败，请联系管理员！', 1.5); 
			}
		});
	}, function(){
	     
	});
}
</script>
</html>
